-
Notifications
You must be signed in to change notification settings - Fork 73
Move spotlight dismissal/re-show logic to server side #11171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: add/payment-method-promotions
Are you sure you want to change the base?
Move spotlight dismissal/re-show logic to server side #11171
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
This removes client-side dismiss/wait/re-show logic in preparation for the WooPayments server handling this functionality. Changes: - Remove filter_variations_by_dismissals() method from promotions service - Simplify mock data to return a single spotlight variation - Remove PromotionTypeConfig and PromotionConfig from client types - Update tests to verify cache clearing and context hash invalidation The client now simply: 1. Sends dismissal timestamps to server via store_context 2. Displays whatever variation the server returns 3. Clears cache on dismissal to trigger fresh server request Fixes WOOPMNT-5531 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
ff310d0 to
0d4f1c7
Compare
|
Size Change: 0 B Total Size: 907 kB ℹ️ View Unchanged
|
mordeth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code changes are looking good!
✅ The spotlight is displayed correctly with the mocked data.
|
@dmallory42, could hold off on this PR as it will definitely conflict with my work (it includes it)? |
|
Thanks for the review, @mordeth - holding off for now while @vladolaru works on the updates to the data shape. |
Fixes WOOPMNT-5531
Changes proposed in this Pull Request
This PR moves the spotlight dismissal/re-show logic from the client to the server side, simplifying the client implementation.
Why is this change needed?
Per the p1764238694991919-slack-C09RCGJFMK7, the dismiss and wait/re-show logic should not be handled on the client. Instead, the client should send dismissal timestamps when requesting promotions, and the server should determine which variation (if any) to return.
What does this change do?
filter_variations_by_dismissals()method fromWC_Payments_PM_Promotions_ServicePromotionTypeConfigandPromotionConfigtypes from clientHow it works now:
store_contextThe client no longer has any dismiss/wait/re-show logic - it just displays whatever the server returns.
How can this code break?
store_contextwhen it's implementedWhat are we doing to make sure this code doesn't break?
Testing instructions
npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge